package com.gome.ocean.service.zookeeper.client;

import java.util.List;

import com.gome.ocean.service.zookeeper.listener.ChildListener;
import com.gome.ocean.service.zookeeper.listener.DataListener;
import com.gome.ocean.service.zookeeper.listener.StateListener;

/**
 * client 接口
 * 
 * @author haqiaolong 2016年7月13日 下午6:35:26
 * @since 5.0.0
 */
public interface ZkClient {

    void init() throws Exception;

    String create(String path, boolean ephemeral, boolean sequential);

    String create(String path, String data, boolean ephemeral, boolean sequential);

    boolean delete(String path);

    boolean exists(String path);

    <T> T getData(String path);

    void setData(String path, String data);

    List<String> getChildren(String path);

    List<String> addChildListener(String path, ChildListener listener);

    void removeChildListener(String path, ChildListener listener);

    void addDataListener(String path, DataListener listener);

    void removeDataListener(String path, DataListener listener);

    void addStateListener(StateListener listener);

    void removeStateListener(StateListener listener);

    boolean isLeader();

    boolean isConnected();

    void close();
}
